 
  let initstate={
     type:"add",
     text:"this is hello word",
     index:0

 }

 function toadd(state=initstate,action){
    
      if(!!!action.index)
      action.index=0;
      
    switch (action.type){
        case 1:
        console.log("进入了toadd"+action.text);
        return    Object.assign({},state, {
           text:action.text
  });
      case 2:
      console.log("index-------"+action.index);
     let a=  Object.assign({},state, {
         index:state.index+1
      });
      console.log(a);
        return a;

      case "3":
        return   Object.assign({},state, {
        // ...state, 
        filter:action.filter
      });
       default:
      return state;
    }
}

export default toadd;